package com.stlm2.dems.entity;

/**
 * 订单状态
 */
public enum OrderState {
    Create(1) {
        public String toString() {
            return "创建订单";
        }
    },
    Cancel(2) {
        public String toString() {
            return "已取消";
        }
    },
    Payment(3) {
        public String toString() {
            return "已支付";
        }
    },
    Delivery(4) {
        public String toString() {
            return "待发货";
        }
    },
    Deliveried(5) {
        public String toString() { return "已发货"; }
    },
    Finish(6) {
        public String toString() {
            return "已完成";
        }
    },
    Refund(7) {
        public String toString() { return "已退款"; }
    },
    Receipt(10) {
        public String toString() { return "确认收货"; }
    },
    Reject(11) {
        public String toString() { return "驳回订单"; }
    },
    RefundApply(12) {
        public String toString() { return "退款申请"; }
    },
    StopBuying(13) {
        public String toString() { return "放弃购买"; }
    };

    private final int val;

    OrderState(int n) {
        val = n;
    }

    public int getIntValue() {
        return val;
    }

    public static OrderState getByIntValue(int n) {
        switch (n) {
            case 1:
                return Create;
            case 2:
                return Cancel;
            case 3:
                return Payment;
            case 4:
                return Delivery;
            case 5:
                return Deliveried;
            case 6:
                return Finish;
            case 7:
                return Refund;
            case 10:
                return Receipt;
            case 11:
                return Reject;
            case 12:
                return RefundApply;
            case 13:
                return StopBuying;
            default:
                return null;
        }
    }
}
